//
//  RecordCell.swift
//  ImGuider X
//
//  Created by 王鹏宇 on 10/9/18.
//  Copyright © 2018 imguider. All rights reserved.
//

import UIKit

class RecordCell: UICollectionViewCell {
    
    @IBOutlet weak var scenicImageView: UIImageView!
    
    @IBOutlet weak var scenicNameLabel: UILabel!
    
    @IBOutlet weak var numLabel: UILabel!
    @IBOutlet weak var progressLabel: UILabel!
    
    var isSelect : Bool = false {
        
        didSet{
            
            if isSelect {
                self.scenicImageView.layer.borderWidth = 3
            }else{
                self.scenicImageView.layer.borderWidth = 0
            }
        }
    }
    override func awakeFromNib() {
        super.awakeFromNib()
        // Initialization code
        
        self.numLabel.backgroundColor = UIColor.hexStringToColor(hexString: "#1CB6ED")
        self.numLabel.layer.cornerRadius = 10
        self.numLabel.clipsToBounds = true
        self.numLabel.textColor = UIColor.white
        
        self.scenicNameLabel.textColor = kContentColor
        self.scenicImageView.layer.borderColor = UIColor.hexStringToColor(hexString: "#0ECEA6").cgColor
        
        self.progressLabel.isHidden = true
    }
    
    var record:Record? {
        
        didSet {
            
            self.scenicImageView.setImage(string: record?.pictureArray?.first, placeholder: UIImage(named: "placeholder_squ")!)
            self.scenicNameLabel.text = record?.spotname
            
            if let num = record?.number {
                self.numLabel.text = "\(num)"
            } else {
                self.numLabel.text = ""
            }
        }
    }
}

